home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 24
/
Aminet 24 (1998)(GTI - Schatztruhe)[!][Apr 1998].iso
/
Aminet
/
util
/
rexx
/
XpkCEd.lha
/
XPKCed.ced
next >
Wrap
Text File
|
1997-11-12
|
16KB
|
487 lines
/* XPKCed.ced */
/*************************************************************************
** $VER: XPKCed.ced 1.1 (16.12.97) **
** **
** Copyright ©1996 Frédéric Delacroix, FreeWare **
** **
** This ARexx script handles XPK-crunched files from within Cygnus-Ed **
** 3.5 (not tested with other versions of CED). This way you will be **
** able to open and save XPK files. **
** **
** This program requires rexxxpk.library and rexxreqtools.library. **
** rexxxpk.library is ©1996 Frédéric Delacroix **
** rexxreqtools.library is ©1992-1993 Rafael D'Halleweyn **
** If the "List packers" option is to be used in the string requester, **
** you need the "RequestList" command (or compatible), which is **
** copyright ©1995 Adam Dawes. **
** **
** Installation: **
** copy XPKCed.ced to REXX: and be sure RexxMast was launched **
** before using this program (this should have been done at **
** startup). Copy the rexxxpk.library to LIBS:. **
** **
** It's quite useful to bind a key to this program. I personnally **
** did bind right amiga ` to XPKCed GUI (defined as a CEd macro). **
** If you want, you can replace (with this method) the keyboard **
** shortcuts of Ced's menus (Open, Save, Save as, etc.) with calls **
** to this macro with corresponding arguments. I don't do this **
** personnally. **
** **
** Usage (launched from Cygnus-Ed): **
** **
** _ XPKCed GUI **
** presents you with a reqtools requester for you to select what **
** to do: OPEN, INCLUDE, SAVE, SAVEAS or SAVEQUIT. A status (as **
** produced by XPKCed STATUS) is also shown in the requester. **
** **
** _ XPKCed OPEN [Password] **
** will open a (possibly) crunched file. The password will be used **
** if the file is crypted. If the file is crypted and no password **
** is given a requester will appear. **
** **
** _ XPKCed INCLUDE [Password] **
** will include a file into the current one, automatically **
** handling XPK compression. **
** **
** _ XPKCed SAVE [Packer[.efficiency] [Password]] **
** will save the file with its previous name, crunched with the **
** mentionned packer. The password, if given, will be used to **
** encrypt the data, provided the packer supports encryption. **
** **
** _ XPKCed SAVEAS [Packer[.efficiency] [Password]] **
** does the same as SAVE, except that a file requester appears for **
** you to select the name of the file to save to. **
** **
** _ XPKCed SAVEQUIT [Packer[.efficiency] [Password]] **
** same as SAVE, except that Ced will quit after saving the file. **
** **
** _ XPKCed STATUS **
** displays a requester displaying XPK information about the last **
** XPKCed operation. **
** **
** WARNINGS: **
** 1) The filenotes are used to store important data. **
** 2) If you open a crunched file, it is first decrunched on disk, **
** so there should be enough room (but it won't cause damage if **
** you don't since the original file is only overwritten if the **
** XPK operation succeeds. Remember to save the file again **
** even if you didn't modify it, or else it will remain **
** in uncompressed form.
** **
** History: **
** 1.00 (16.10.96) - hardly released at all, just a personnal tool **
** for my everyday Amiga use :-) **
** 1.01 (16.12.97) - well, 14 months later! Isn't that sustained **
** development ? :-) I just fixed a small bug **
** and added some documentation. **
** It might be about time for the first aminet **
** release... **
** **
** THIS PROGRAM IS FREEWARE, MEANING THAT IT IS OFFERED TO YOU AS A **
** GIFT, YOU DO NOT HAVE TO PAY ANYTHING FOR IT, EXCEPT FOR MINIMAL **
** COPY & SHIPPING FEES. YOU MAY DISTRIBUTE COPIES OF IT TO ANYONE YOU **
** WANT, BUT YOU MUST DISTRIBUTE THE ENTIRE AND UNMODIFIED ARCHIVE. **
** COMMERCIAL USAGE IS FORBIDDEN WITHOUT MY WRITTEN PERMISSION. **
** MOREOVER, I WILL NOT BE HELD RESPONSIBLE FOR ANY DAMAGE THE USE **
** OF THIS PROGRAM MAY CAUSE. ALL USE IS AT YOUR OWN RISK. BY USING **
** THIS PROGRAM AND RELATED FILES, YOU AGREE WITH THIS DISCLAIMER. **
** **
** Feel free to contact me: **
** - Snail-Mail (new address!): **
** Frédéric Delacroix **
** 4, rue Mirland **
** 59300 VALENCIENNES **
** FRANCE **
** - Fidonet: **
** sorry, not available for now **
** _ Francomédia: **
** 101:176/114.8 **
** - Internet (not very reliable): **
** frederic.delacroix@p8.f20.n322.z2.fidonet.org **
** **
*************************************************************************/
IF ~SHOW('Libraries','rexxxpk.library') THEN
IF ~ADDLIB('rexxxpk.library',0,-30,1) THEN EXIT 20
IF ~SHOW('Libraries','rexxreqtools.library') THEN
IF ~ADDLIB('rexxreqtools.library',0,-30,1) THEN EXIT 20
IF ~SHOW('Libraries','rexxsupport.library') THEN
IF ~ADDLIB('rexxsupport.library',0,-30,1) THEN EXIT 20
OPTIONS RESULTS
PARSE ARG action arguments
UPPER action
SELECT
WHEN action=="GUI" THEN XPKGui(arguments)
WHEN action=="OPEN" THEN XPKOpen(arguments)
WHEN action=="INCLUDE" THEN XPKInclude(arguments)
WHEN action=="SAVE" THEN XPKSave(arguments)
WHEN action=="SAVEAS" THEN XPKSaveAs(arguments)
WHEN action=="SAVEQUIT" THEN XPKSaveQuit(arguments)
WHEN action=="STATUS" THEN XPKStatus(arguments)
OTHERWISE rtezrequest("Unknown action.",,"XPKCed: Problem.",eztags)
END
EXIT
/**** XPKGui ****/
XPKGui: PROCEDURE
CALL GetRexxTags
msg='0A'X || '0A'X || "Please select operation:"
o=rtezrequest(XPKStatMsg() || msg,"_Open...|_Include...|_Save|Save _as...|Save and _Quit|_Cancel","XPKCed: GUI mode",eztags,)
SELECT
WHEN o=1 THEN XPKOpen(ARG(1))
WHEN o=2 THEN XPKInclude(ARG(1))
WHEN o=3 THEN XPKSave(ARG(1))
WHEN o=4 THEN XPKSaveAs(ARG(1))
WHEN o=5 THEN XPKSaveQuit(ARG(1))
OTHERWISE NOP
END
RETURN 0
/**** XPKOpen ****/
XPKOpen: PROCEDURE
PARSE ARG password .
CALL GetRexxTags
IF AskLose() THEN RETURN 0
status dirname
dirname=RESULT
status restname
filename=RESULT
filename=rtfilerequest(dirname,filename,"XPK Open","_Open",multiselecttags,files)
IF filename="" THEN RETURN 0
IF DecompressFile(files.1) THEN RETURN 0
"Open" losefile '22'X || files.1 || '22'X
IF files.count>1 THEN DO i=2 TO files.count
IF DecompressFile(files.i) THEN RETURN 0
"Open new"
"Open" '22'X || files.i || '22'X
END
RETURN 0
/**** XPKInclude ****/
XPKInclude: PROCEDURE
PARSE ARG password .
CALL GetRexxTags
filename=rtfilerequest(,,"XPK Include","_Include",fileselecttags,)
IF (filename="") | (~rtresult) THEN RETURN 0
IF DecompressFile(filename) THEN RETURN 0
"Include file" '22'X || filename || '22'X
RETURN 0
/**** XPKSave ****/
XPKSave: PROCEDURE
PARSE ARG packer password .
CALL GetRexxTags
status filename
fname=RESULT
fstate=STATEF(fname)
defpacker=packer
IF defpacker="" THEN PARSE UPPER VAR fstate . . . . . . . defpacker . .
"Save"
IF ~RESULT THEN RETURN 0
status filename
fname=RESULT
IF CompressFile(fname) THEN RETURN 0
RETURN 0
/**** XPKSaveAs ****/
XPKSaveAs: PROCEDURE
PARSE ARG packer password .
CALL GetRexxTags
status filename
fname=RESULT
fstate=STATEF(fname)
defpacker=packer
IF defpacker="" THEN PARSE UPPER VAR fstate . . . . . . . defpacker . .
"Save as"
IF ~RESULT THEN RETURN 0
status filename
fname=RESULT
IF CompressFile(fname) THEN RETURN 0
RETURN 0
/**** XPKSaveQuit ****/
XPKSaveQuit: PROCEDURE
PARSE ARG packer password .
CALL GetRexxTags
status filename
fname=RESULT
fstate=STATEF(fname)
defpacker=packer
IF defpacker="" THEN PARSE UPPER VAR fstate . . . . . . . defpacker . .
"Save"
IF ~RESULT THEN RETURN 0
status filename
fname=RESULT
IF CompressFile(fname) THEN RETURN 0
OPTIONS FAILAT 11 /* to counter Ced's strange behavior with last quit */
"Quit"
RETURN 0
/**** XPKStatus ****/
XPKStatus: PROCEDURE
CALL GetRexxTags
rtezrequest(XPKStatMsg(),,"XPKCed: status",eztags,)
RETURN 0
/**** Other functions ****/
/* XPKStatMsg: returns the status message to display in requesters
of STATUS and GUI */
XPKStatMsg: PROCEDURE
xpkclip=GetClip(XPKCed)
IF xpkclip="" THEN xpkclip="0 ????